﻿using IdentityServer4.Services;
using IdentityServer4.Validation;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;

namespace IdentityServerManagement
{
    public static class XmsIdentityServerServiceCollectionExtensions
    {
        public static void AddAbpStrictRedirectUriValidator(this IServiceCollection services)
        {
            services.Replace(ServiceDescriptor.Transient<IRedirectUriValidator, XmsStrictRedirectUriValidator>());
        }

        public static void AddAbpClientConfigurationValidator(this IServiceCollection services)
        {
            services.Replace(ServiceDescriptor.Transient<IClientConfigurationValidator, XmsClientConfigurationValidator>());
        }

        public static void AddAbpWildcardSubdomainCorsPolicyService(this IServiceCollection services)
        {
            services.Replace(ServiceDescriptor.Transient<ICorsPolicyService, XmsWildcardSubdomainCorsPolicyService>());
        }
    }
}
